//
//  UIButton+Extension.swift
//  LRWeibo
//
//  Created by 雷路荣 on 15/12/21.
//  Copyright © 2015年 leilurong. All rights reserved.
//

import UIKit

extension UIButton {
    //MARK - 便利构造函数
    convenience init(imageName: String, title: String, sizeFont: CGFloat, textColor: UIColor) {
        self.init()//不要用super,调用init创建对象,下面代码才可以省self
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        setTitle(title, forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(sizeFont)
        setTitleColor(textColor, forState: UIControlState.Normal)
        setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Highlighted)
    }

}
